var t = getApp();

Page({
    data: {
        active: 0,
        page: 1
    },
    onLoad: function(t) {
        this.getData();
    },
    onChange: function(t) {
        this.data.page = 1, this.setData({
            active: t.detail.name
        }), this.getData();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.current_page < this.data.last_page ? (wx.showLoading({
            title: "加载中",
            mask: !0
        }), this.setData({
            page: this.data.page + 1
        }), this.getNext(this.data.active)) : wx.showToast({
            title: "没有更多",
            icon: "none"
        });
    },
    getData: function() {
        var a = this, e = t.getNetAddresss("plugin.love-queue.frontend.modules.credit.controllers.records.index");
        t._getNetWork({
            url: e,
            data: {
                status: this.data.active
            },
            success: function(t) {
                var e = t.data;
                1 == e.result ? a.setData({
                    love_gift_queue_list: e.data.page_list.data,
                    current_page: e.data.page_list.current_page,
                    last_page: e.data.page_list.last_page
                }) : console.log("请求失败"), 0 == e.result && a.setData({
                    love_gift_queue_list: !1,
                    errnone: e.msg
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    getNext: function() {
        var a = this, e = t.getNetAddresss("plugin.love-queue.frontend.modules.credit.controllers.records.index");
        t._getNetWork({
            url: e,
            data: {
                status: a.data.active,
                page: a.data.page
            },
            success: function(t) {
                var e = t.data;
                if (1 == e.result) {
                    if (e.data.page_list.current_page > e.data.page_list.last_page) return wx.hideLoading(), 
                    wx.showToast({
                        title: "没有更多",
                        icon: "none"
                    }), void a.setData({
                        current_page: e.data.page_list.current_page,
                        last_page: e.data.page_list.last_page
                    });
                    wx.hideLoading(), a.setData({
                        love_gift_queue_list: a.data.love_gift_queue_list.concat(e.data.page_list.data),
                        current_page: e.data.current_page,
                        last_page: e.data.last_page
                    });
                } else console.log("请求失败");
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    onShareAppMessage: function() {}
});